package com.app.util.printer;

import com.app.util.date.Calculagraph;
import com.app.util.date.Countdown;

public class RichProgress extends Progress {

	private Countdown countdown;
	private Calculagraph calc;

	public RichProgress(String title) {
		super(title);
		countdown = new Countdown();
		calc = new Calculagraph("HH小时mm分ss秒");
		countdown.setFormat(calc.getFormat());
		countdown.start();
	}
 
	public void setValue(int value) {
		super.setValue(value);
		countdown.setTimeCount((long) (((float) calc.millisTotal() / getValue()) * getMaxValue()));
	}

	public void print(String msg) {
		super.print("耗时:" + calc + " 预计剩余时间:" + countdown + " " + msg);
	}

	public void print() {
		super.print("耗时:" + calc + " 预计剩余时间:" + countdown);
	}
}
